/*
 * Copyright (c) 2018. czmc All Rights Reserved.
 * Author: czmc
 * Email: zxc6355533@163.com
 * Encoding: UTF-8
 */

package top.stime21.myneighbours.module.myneed

import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentPagerAdapter

/**
 * Author: czmc  Email: @tuwan21.com
 * Version:	1.0  Date:3/5/2018
 */
class MyNeedAdapter : FragmentPagerAdapter {
    private var data: ArrayList<MyNeedFragment>? = null
    private var title: ArrayList<String>? = null

    constructor(fm: FragmentManager?) : super(fm) {
        data = arrayListOf<MyNeedFragment>(MyNeedFragment(1), MyNeedFragment(2), MyNeedFragment(3))
        title = arrayListOf<String>("我的发布", "我的贡献", "全部")
    }

    override fun getPageTitle(position: Int): CharSequence? {
        return title!!.get(position)
    }

    override fun getItem(position: Int): Fragment {
        return data!!.get(position)
    }

    override fun getCount(): Int {
        return data!!.size
    }
}